/*  Copyright (C) 2008  Alexander Blyzniuchenko (BlezAlex)

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Collections.Generic;

namespace DC
{
    public class UserIpListEventArgs: EventArgs
    {
        private readonly List<UserIpEntry> _entries = new List<UserIpEntry>();

        internal void Load(string entryPair)
        {
            UserIpEntry e = new UserIpEntry(entryPair);
            if (!string.IsNullOrEmpty(e.Nick))
                _entries.Add(e);
        }

        public List<UserIpEntry> UserIPList
        {
            get { return _entries;}
        }
    }

    public class UserIpEntry
    {
        private readonly string _nick;
        private readonly string _ip;

        public UserIpEntry(string entyPair)
        {
            string[] pairs = entyPair.Trim().Split(' ');
            if (pairs.Length == 2)
            {
                _nick = pairs[0];
                _ip = pairs[1];
            }
        }

        public string Nick
        {
            get { return _nick; }
        }

        public string IP
        {
            get { return _ip; }
        }
    }

}

